#include "stdafx.h"
#include "../gamemgr.h"
#include "./mainpage.h"

//bkg
#define BKG_NAME "main.jpg"
#define BKG_POS Point(0, 0)
#define BKG_DEPTH 0

//btn_playermode
#define BTN_PLAYERMODE_NAME "btn_playermode"
#define BTN_PLAYERMODE_POS Point(37, 65)

//btn_enemymode
#define BTN_ENEMYMODE_NAME "btn_enemymode"
#define BTN_ENEMYMODE_POS Point(37, 45)

//btn_exit
#define BTN_EXITMODE_NAME "btn_exit"
#define BTN_EXITMODE_POS Point(37, 25)

MainPage::MainPage()
: m_bkg(BKG_NAME, BKG_POS, BKG_DEPTH)
, m_btnPlayerMode(BTN_PLAYERMODE_NAME, BTN_PLAYERMODE_POS, GameMgr::GetInstance().GetStageDepth())
, m_btnEnemyMode(BTN_ENEMYMODE_NAME, BTN_ENEMYMODE_POS, GameMgr::GetInstance().GetStageDepth())
, m_btnExit(BTN_EXITMODE_NAME, BTN_EXITMODE_POS, GameMgr::GetInstance().GetStageDepth())
{
	m_btnPlayerMode.OnClick += EventObject<OnButtonClickFunc>(this, &MainPage::OnBtnPlayerModeClick);
	m_btnEnemyMode.OnClick += EventObject<OnButtonClickFunc>(this, &MainPage::OnBtnEnemyModeClick);
	m_btnExit.OnClick += EventObject<OnButtonClickFunc>(this, &MainPage::OnBtnExitClick);
}

MainPage::~MainPage()
{

}

void MainPage::SetVisible(bool v)
{
	m_bkg.SetVisible(v);
	m_btnPlayerMode.SetVisible(v);
	m_btnEnemyMode.SetVisible(v);
	m_btnExit.SetVisible(v);
}

void MainPage::OnBtnPlayerModeClick()
{
	FireEvent(OnMainPagePlayerModeClickFunc, OnPlayerModeClick, ());
}

void MainPage::OnBtnEnemyModeClick()
{
	FireEvent(OnMainPageEnemyModeClickFunc, OnEnemyModeClick, ());
}

void MainPage::OnBtnExitClick()
{
	FireEvent(OnMainPageExitClickFunc, OnExitClick, ());
}